package com.chen;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.Toast;

import com.util.ImageAdapter;

public class GridViewTestActivity extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.gridview_test_layout);
		GridView gridView = (GridView) findViewById(R.id.gridViewTest);
		gridView.setAdapter(new ImageAdapter(this));
		
		gridView.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
//				Log.d(Constant.CHENDEBUT, arg2+"");
				Toast.makeText(GridViewTestActivity.this, "adapterView's id is "+arg0.getId()+" \n imagePosition is "+arg2, Toast.LENGTH_LONG).show();
			}
		});
	}
}
